<template>
  <view class="page">
    <view class="t-card">
      <view class="t-card__title">设置</view>
      <view class="section">
        <button class="t-button" @tap="logout">退出登录</button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  methods: {
    /**
     * 退出登录：清除token与用户信息并返回主页
     */
    logout() {
      uni.removeStorageSync('token')
      uni.removeStorageSync('userInfo')
      uni.showToast({ title: '已退出', icon: 'success' })
      setTimeout(() => {
        uni.reLaunch({ url: '/pages/home/index' })
      }, 400)
    }
  }
}
</script>

<style>
.page { padding: 24rpx; }
.section { margin-top: 24rpx; }
.t-card { background: #fff; border-radius: 16rpx; padding: 24rpx; box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.04); }
.t-card__title { font-size: 32rpx; font-weight: 600; color: #222; }
.t-button { height: 80rpx; padding: 0 32rpx; border-radius: 12rpx; background: #EEF2FF; color: #0052D9; border: 1px solid #DCE1EB; }
</style>
